package com.appwoo.txtws.component;

import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

public class SimpleZoomListener
  implements View.OnTouchListener
{
  private ControlType mControlType = ControlType.PAN;
  private float mGap;
  private ZoomState mState;
  private float mX;
  private float mY;

  private float getGap(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4)
  {
    return (float)Math.pow(Math.pow(paramFloat1 - paramFloat2, 2.0D) + Math.pow(paramFloat3 - paramFloat4, 2.0D), 0.5D);
  }

  public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
  {
    int i = paramMotionEvent.getAction();
    int j = paramMotionEvent.getPointerCount();
    int k = paramView.getLeft();
    int m = paramView.getRight();
    int n = paramView.getTop();
    int i1 = paramView.getBottom();
    ((k + m) / 2);
    ((n + i1) / 2);
    if (j == 1);
    try
    {
      f7 = paramMotionEvent.getX();
      f8 = paramMotionEvent.getY();
      switch (i)
      {
      case 1:
      default:
        if (j != 2);
        break;
      case 0:
      case 2:
      }
    }
    catch (IllegalArgumentException localIllegalArgumentException2)
    {
      try
      {
        float f7;
        float f8;
        f1 = paramMotionEvent.getX(paramMotionEvent.getPointerId(0));
        f2 = paramMotionEvent.getY(paramMotionEvent.getPointerId(0));
        f3 = paramMotionEvent.getX(paramMotionEvent.getPointerId(1));
        f4 = paramMotionEvent.getY(paramMotionEvent.getPointerId(1));
        f5 = getGap(f1, f3, f2, f4);
        switch (i)
        {
        default:
        case 5:
        case 261:
          while (true)
          {
            return true;
            this.mX = f7;
            this.mY = f8;
            break;
            localIllegalArgumentException2 = localIllegalArgumentException2;
            localIllegalArgumentException2.printStackTrace();
            break;
            float f9 = (f7 - this.mX) / paramView.getWidth();
            float f10 = (f8 - this.mY) / paramView.getHeight();
            this.mState.setPanX(this.mState.getPanX() - f9);
            this.mState.setPanY(this.mState.getPanY() - f10);
            this.mState.notifyObservers();
            this.mX = f7;
            this.mY = f8;
            break;
            this.mGap = f5;
          }
        case 6:
        case 262:
        case 2:
        }
      }
      catch (IllegalArgumentException localIllegalArgumentException1)
      {
        while (true)
        {
          float f1;
          float f2;
          float f3;
          float f4;
          float f5;
          localIllegalArgumentException1.printStackTrace();
          continue;
          this.mX = f3;
          this.mY = f4;
          continue;
          this.mX = f1;
          this.mY = f2;
          continue;
          float f6 = (f5 - this.mGap) / this.mGap;
          this.mState.setZoom(this.mState.getZoom() * (float)Math.pow(5.0D, f6));
          this.mState.notifyObservers();
          this.mGap = f5;
        }
      }
    }
  }

  public void setControlType(ControlType paramControlType)
  {
    this.mControlType = paramControlType;
  }

  public void setZoomState(ZoomState paramZoomState)
  {
    this.mState = paramZoomState;
  }

  public static enum ControlType
  {
    static
    {
      ControlType[] arrayOfControlType = new ControlType[2];
      arrayOfControlType[0] = PAN;
      arrayOfControlType[1] = ZOOM;
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.component.SimpleZoomListener
 * JD-Core Version:    0.6.2
 */